#ifndef STATEMANAGER_H
#define STATEMANAGER_H

#include <QObject>
#include "appGlobals.h"
class AbstractState;

class StateManager : public QObject
{
    Q_OBJECT
public:
    typedef QList<QPointer<AbstractState> > States;
    explicit StateManager(QObject *parent = 0);

    void registerState(QPointer<AbstractState> state);
    QPointer<AbstractState> currentState() const;
protected:
	const States& states() const;
private:
    QPointer<AbstractState> stateById(const QString& sid);
    States m_states;
    QPointer<AbstractState> m_currentState;
signals:
    void currentStateAboutToChange();
    void currentStateChanged();
public slots:
	void changeState(const QString& stateId);
	void changeState(QPointer<AbstractState> state);
};

#endif // STATEMANAGER_H
